/*
+--------------------------------------------------------------------------
|   Mblog [#RELEASE_VERSION#]
|   ========================================
|   Copyright (c) 2014, 2015 mtons. All Rights Reserved
|   http://www.mtons.com
|
+---------------------------------------------------------------------------
*/
package com.mtons.mblog.modules.service.impl;

import com.alibaba.fastjson.TypeReference;
import com.mtons.mblog.base.utils.BeanUtils;
import com.mtons.mblog.modules.data.MusicVo;
import com.mtons.mblog.modules.entity.Music;
import com.mtons.mblog.modules.repository.MusicRepository;
import com.mtons.mblog.modules.service.MusicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author langhsu
 *
 */
@Service
public class MusicServiceImpl implements MusicService {

	@Autowired
	private MusicRepository musicRepository;
	@Override
	public List<MusicVo> findALL() {
		List<Music> musics = musicRepository.findAll();
		List<MusicVo> musicVos = BeanUtils.copyProperties(musics, new TypeReference<List<MusicVo>>() {
		});
		return musicVos;

	}
}
